package io.geekidea.boot.test.controller;

import io.geekidea.boot.framework.page.Paging;
import io.geekidea.boot.framework.response.ApiResult;
import io.geekidea.boot.test.query.AppCollegesQuery;
import io.geekidea.boot.test.service.CollegesService;
import io.geekidea.boot.test.vo.AppCollegesVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * Appnull 控制器
 *
 * @author geekidea
 * @since 2025-02-19
 */
@Slf4j
@RestController
@Tag(name = "Appnull")
@RequestMapping("/app/colleges")
public class AppCollegesController {

    @Autowired
    private CollegesService collegesService;

    /**
     * 获取Appnull详情
     *
     * @param id
     * @return
     * @throws Exception
     */
    @Operation(summary = "获取Appnull详情")
    @PostMapping("/getAppColleges/{id}")
    public ApiResult<AppCollegesVo> getAppColleges(@PathVariable Long id) {
        log.info("获取Appnull详情：{}", id);
        AppCollegesVo appCollegesVo = collegesService.getAppCollegesById(id);
        return ApiResult.success(appCollegesVo);
    }

    /**
     * 获取Appnull分页列表
     *
     * query
     * @return
     * @throws Exception
     */
    @Operation(summary = "获取Appnull分页列表")
    @PostMapping("/getAppCollegesPage")
    public ApiResult<AppCollegesVo> getAppCollegesPage(@Valid @RequestBody AppCollegesQuery query) {
        log.info("获取Appnull分页列表：{}", query);
        Paging<AppCollegesVo> paging = collegesService.getAppCollegesPage(query);
        return ApiResult.success(paging);
    }

}
